//
//  GlobalSetting.h
//  CoolTennisBall
//
//  Created by 谢伟康 on 15/12/14.
//  Copyright © 2015年 CoolLang. All rights reserved.
//

#import "ColorEnum.h"
#import "TennisBallEnum.h"
#import "Common.h"


#ifndef GlobalSetting_h
#define GlobalSetting_h

#pragma mark - 全局设置

//NETWORK_ENVIRONMENT:0是生产环境，1是测试环境
#define ENVIRONMENT 0

#if ENVIRONMENT == 0
//    #define kBaseUrl @"http://appserv.coollang.com"
    #define kBaseUrl @"http://tennis.coollang-overseas.com"
//    #define kBaseUrl @"http://tennis.coollang.com"
#elif ENVIRONMENT == 1
//    #define kBaseUrl @"http://192.168.199.130"
    #define kBaseUrl @"http://mlf.f3322.net:83"
#endif

#pragma mark - 全局宏定义
#define LOCATION(STRING) NSLocalizedStringFromTable(STRING,@"Location",nil)
#define MYFONT(SIZE) [UIFont fontWithName:@"HelveticaNeue" size:SIZE]

#define FontDescriptorMedium(FONTSIZE) [UIFontDescriptor fontDescriptorWithFontAttributes:@{UIFontDescriptorFamilyAttribute:@"Helvetica Neve",UIFontDescriptorNameAttribute:@"Helvetica Neve Medium", UIFontDescriptorSizeAttribute:@(FONTSIZE)}]

#define SanFranciscoFont(SIZE) [UIFont fontWithName:@"San Francisco Display" size:SIZE]

//登录失效的通知
#define kNetworkingManagerLoginFailNotification @"NetworkingManagerLoginFailNotification"

#define kCurrentLanguage [NSLocale preferredLanguages].firstObject

//配对设备成功的通知
#define kMatchDeviceSuccess @"MatchDeviceSuccess"

#define MyTabbarView [UIApplication sharedApplication].keyWindow.rootViewController.presentedViewController.view

//MARK: ----------------------Global Frames-----------------------------

/// 屏幕的长宽
#define kYFScreenWidth  ApplicationBounds().size.width
#define kYFScreenHeight ApplicationBounds().size.height

/// 导航栏默认高度
#define kNavigationBarHeight 44.0f
/// 标签栏默认高度
#define kTabBarHeight 49.0f

/// 纯代码适配等比例拉伸(以iPhone6/6s计算)
#define kSCREEN_WIDTH_RATIO (kYFScreenWidth/375.0)
#define kSCREEN_HEIGHT_RATIO (kYFScreenHeight<500?1:kYFScreenHeight/667.0) /// 5/5s以下不做等比例缩放
#define kAutoWid(w) (w*kSCREEN_WIDTH_RATIO)
#define kAutoHei(h) (h*kSCREEN_HEIGHT_RATIO)

#define         iPhone5                 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define         iPhone6                 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

#define         iPhone6BigMode          ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define         iPhonePlus              ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)

#define         iPhonePlusBigMode       ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) : NO)


// 做iPhoneX适配
#define  adjustsScrollViewInsets_NO(scrollView,vc)\
do { \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Warc-performSelector-leaks\"") \
if ([UIScrollView instancesRespondToSelector:NSSelectorFromString(@"setContentInsetAdjustmentBehavior:")]) {\
[scrollView   performSelector:NSSelectorFromString(@"setContentInsetAdjustmentBehavior:") withObject:@(2)];\
} else {\
vc.automaticallyAdjustsScrollViewInsets = NO;\
}\
_Pragma("clang diagnostic pop") \
} while (0)


#endif /* GlobalSetting_h */
